<#include "/common/layout.html">
<@header>
</@header>
<@body>
<div class="content-wrapper">
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      <small>系统管理 > 数据上传</small>
    </h1>
  </section>
  <!-- Main content -->
  <section class="content">
    <!-- Your Page Content Here
    <div class="row">
      <div class="col-xs-12">
        <div class="box">
           <form action="${base}/excel/importExcels" method="post" class="form-inline" enctype="multipart/form-data">
               <input type="file" name="file">
               <input type="submit" value="submit"/>
           </form>

        </div>
      </div>
    </div>
     -->
    <!-- start -->
    <div class="row">
        <div class="col-xs-12">
              
              <div class="box">
              		<form action=""  class="form-inline" method="post">
              			<div class="box-header">
              				<div class="input-group">
					            <a class="btn btn-primary dialog" href="javascript:" data-url="${base}/college/student/toAdd" data-title="添加学生" data-width="800" data-height="550"><i class="fa fa-plus"></i> 添加学生</a>
				            </div>
              				<div class="input-group">
	              				<input type="text" name="search" value="${search!}" class="form-control" placeholder="请输入名字或者手机号">
				               <div class="input-group-btn">
				                 <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
				               </div>
	              			</div>
	              			<div class="input-group"><button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-default">
	                			模板批量上传
	              			</button></div>
	              			<div class="input-group"><a href="${base}/templete/doc/template.xls" style="color: #ffc250;font-size: 12px;">模板下载</a></div>
              				<div class="modal fade" id="modal-default" style="display: none;">
					          <div class="modal-dialog">
					            <div class="modal-content">
					              <div class="modal-header">
					                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
					                  <span aria-hidden="true">×</span></button>
					                <h4 class="modal-title">模版批量上传</h4>
					              </div>
					              <div class="modal-body">
					                <p><input type="file" name="file" id="file"></p>
					              </div>
					              <div class="modal-footer">
					                <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="modelClose">关闭</button>
					                <button type="button" class="btn btn-primary" id="upload">上传</button>
					              </div>
					            </div>
					            <!-- /.modal-content -->
					          </div>
					          <!-- /.modal-dialog -->
					        </div>
              			</div>
              			
              		</form>
              		
              	<div style="height: 20px;">
              	</div>
              	<!-- start -->
		        <div class="box-body table-responsive no-padding">
		        	<table class="table table-hover">
		        		<tr>
			                <th  width="60px"><input name="colIndex" type="checkbox" class="minimal checkbox-toolbar"> </th>
			                <th align="center">姓名</th>
			                <th align="center">性别</th>
			                <th align="center">手机</th>
			                <th align="center">学校</th>
			                <th align="center">专业</th>
			                <th align="center">日期</th>
			                <th align="center">状态</th>
			                <th width="120px">操作</th>
			              </tr>
			              <#if pageData>
			              <#list pageData.getRecords() as obj>
			              <tr>
			              	<td><label>
	                	<input type="checkbox" class="minimal checkbox-item">
	                	${((pageData.current-1)*pageData.size +obj_index+1)!}
	                	</label></td>
			              	<td>${(obj.name)!}</td>
			              	<td>
			              		<#if obj.sex == 1>
			              		男
			              		<#else>
			              		女
			              		</#if>
			              	</td>
			              	<td>${(obj.phone)!}</td>
			              	<td>${(obj.schoolName)!}</td>
			              	<td>${(obj.major)!}</td>
			              	<td>${obj.createTime?string("yyyy-MM-dd")}</td>
			              	<td>
			              		<#if obj.status == 'MS01'>
			              			未激活
			              		<#elseif obj.status == 'MS02'>
			              		激活
			              		<#else>
			              		冻结
			              		</#if>
			              	
			              	</td>
			              	<td>
			              		<a class="btn btn-primary btn-xs dialog" href="javascript:" data-url="${base}/college/student/edit/${obj.phone}" data-title="编辑学生信息" data-width="850" data-height="550">编辑</a>
			              	</td>
			              </tr>
			              </#list>
			              </#if>
		        	</table>
		        </div>
		        <!-- end -->
		        <div class="box-footer row">
		            <div class="col-md-6">
		         	  <#include "/common/paginateBar.html" />
		         	  <#if pageData>
			  		  <@paginate pageData=pageData actionUrl="${base}/college/importPage/" urlParas="?search=${search!}&daterange=${daterange!}"  />
			  		  </#if>
		            </div>
		            <div class="col-md-6 pull-left">
			             <#include "/common/paginate.html" />
			             <#if pageData>
			  			 <@paginate currentPage=pageData.getCurrent() totalPage=pageData.getPages() actionUrl="${base}/college/importPage/" urlParas="?search=${search!}&pageSize=${pageSize!}"  />
		            	</#if>
		            </div>
		          </div>
              </div>
        </div>
        
      </div>
    <!-- end -->
  </section><!-- /.content -->
</div><!-- /.content-wrapper -->
</@body>
<@footer>
</@footer>
<script type="text/javascript">
	$(function(){
		$("#upload").on('click',function(){
			var fileForm = new FormData();
			fileForm.append("file", $("#file").get(0).files[0]);
			$.ajax({
			    url: '${base}/excel/importExcels',
			    type: 'POST',
			    cache: false,
			    data: fileForm,
			    processData: false,
			    contentType: false
			}).done(function(res) {
				layer.msg(res.msg);
				$("#modelClose").trigger('click');
			}).fail(function(res) {
				console.log(res);
			});
		});
	});
</script>